<!DOCTYPE html>
<html lang="en">
<head>
  <title>浩然金融中心管理平台</title>
  <meta charset="utf-8">
  <meta content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0"
        name="viewport">
  <#include "/common/csslib.html">
  <script type="text/javascript">
      var ctrLoanContTable;
      var selectType = "${selectType}";
      var parentController = "${parentController}";
  </script>
</head>
<body>
<div class="main-wrapper">
  <!-- start: MAIN CONTAINER -->
  <div class="main-container inner">
    <!-- start: PAGE -->
    <div class="main-content">
      <div class="container">
        <!-- 查询筛选内容 bagin -->
        <div class="row h-main-search">
          <form action="javascript:;" method="post">
            <div class="col-sm-2 text-right">
              <label class="control-labe h-form-label" for="form-field-1">客户编号：</label>
            </div>
            <div class="col-sm-2">
              <input class="col-sm-1 form-control" id="cusId" name="cusId" type="text" value="">
            </div>
            <div class="col-sm-2 text-right">
              <label class="control-labe h-form-label" for="form-field-1">客户名称：</label>
            </div>
            <div class="col-sm-2">
              <input class="form-control" id="cusName" name="cusName" type="text" value="">
            </div>

            <div class="pull-right h-btn-group">
              <button class="btn btn-info" onclick="CtrLoanContManager.search()" type="button"><i class="fa fa-search">&nbsp;&nbsp;</i>查询
              </button>
              <button class="btn btn-default" type="reset"><i class="fa fa-mail-reply">&nbsp;&nbsp;</i>重置</button>
            </div>
          </form>
        </div>

        <!-- 表格 begin -->
        <div class="panel panel-white h-panel">
          <div class="panel-body">
            <table class="table table-striped table-bordered table-hover text-center" id="ctrLoanCont_table"
                   style="width:100%"></table>
          </div>
        </div>
        <!-- 表格 end -->
      </div>
    </div>
    <!-- end: PAGE -->
  </div>
  <!-- end: MAIN CONTAINER -->

  <!-- 新增 end -->
  <!-- end: SUBVIEW SAMPLE CONTENTS -->


  <!-- modal start -->

  <!-- modal end -->
</div>
<#include "/common/jslib.html">

<script type="text/javascript">
    $(function () {
        var api = frameElement.api, W = api.opener;
        CtrLoanContManager = {
            // 初始化
            init: function () {
                api.button({
                    id: 'ok',
                    name: '确认选择',
                    callback: CtrLoanContManager.selectCtrLoanCont
                });
                api.button({
                    id: 'cancel',
                    name: '关闭'
                });
            },
            search: function () {
                var queryCond = {
                    cusId: $("#cusId").val()
                    , cusName: $("#cusName").val()
                    , certType: $("#certType").val()
                    , prdName: $("#prdName").val()
                };
                ctrLoanContTable.options.queryCond = queryCond;
                var tableId = ctrLoanContTable.options.tableId;
                $(tableId).DataTable().draw();
            },
            selectCtrLoanCont: function () {
                var ctrLoanCont_select = $("input[name='ctrLoanCont_select']:checked");
                var selectStr = "";
                /* if(selectType == "multiple"){
                  ctrLoanCont_select.each(function(i){
                       if(0==i){
                         selectStr = $(this).val();
                       }else{
                         selectStr += (","+$(this).val());
                       }
                    });
                }else{ */
                selectStr = ctrLoanCont_select.val();
                W.initValue(selectStr);
                //}
                api.close();
                return false;
            }
        }
        //执行初始化
        CtrLoanContManager.init();
    });
</script>
<!-- 弹窗下拉 -->
<script type="text/javascript">
    (function () {
        // datatable插件
        ctrLoanContTable = new mi.datatable({
            "aoColumnDefs": [
                {"sWidth": "20%", "aTargets": [0]}
            ],
            "bAutoWidth": true,
            tableId: '#ctrLoanCont_table',
            headerList: [
                '选择框',
                '序号',
                '客户编号',
                '客户名称',
                '证件类型',
                '产品代码',
                '申请日期',
                '产品名称'
            ],
            headerName: [
                'operate',
                'table_no',
                'cusId',
                'cusName',
                'certType',
                'prdCode',
                'aplDate',
                'prdName'
            ],

            ajaxUrl: '/demo/listCtrLoanCont',
            queryCond: function () {

            },
            columnDefs: [
                {}
            ],
            dataSrc: function (data) {
                var newArr = [];
                for (var i in data) {
                    var contNo = data[i]['contNo'];
                    var cusId = data[i]['cusId'];
                    var cusName = data[i]['cusName'];
                    var str = contNo + "," + cusId + "," + cusName;
                    var viewDtr = mi.markLink({
                        href: 'javascript:void(0)',
                        txt: selectType == "multiple" ?
                            "<input type='checkBox' id='ctrLoanCont_select' name='ctrLoanCont_select' value='" + str + "'/>" :
                            "<input type='radio' id='ctrLoanCont_select' name='ctrLoanCont_select' value='" + str + "'/>",
                        className: 'js-del-row-btn',
                        data: [
                            {contNo: contNo}
                        ]
                    });
                    data[i]['operate'] = viewDtr;
                    data[i]['table_no'] = Number(i) + 1;
                }
                return data;
            }
        });
    })();
</script>
</body>
</html>
